<template>
  <!-- 采购发票 -->
  <section class="content-box">
    <div>
      <!--列表-->
      <div v-if="isshowList">
          <el-col :span="24" class="SuppC-toolbar">
            <el-form class="title">
              <div class="cover">
                <h2>采购发票</h2>
                <!-- <img @click="handleInvoice" class="SuppC-common-icon" src="../../../../static/content/images/Common/common-add.png" alt=""/> -->
                <el-button @click="handleInvoice()" size="small" class="el-icon-plus">&nbsp;新建</el-button>
                <el-button @click="search()" size="small" class="el-icon-search">&nbsp;查询</el-button>
              </div>
              <el-form-item class="cover">
                <div class="list-img" @click="handlePay">
                  <img class="SuppC-common-icon" src="../../../../static/content/images/Common/common-pay.png" alt=""/>
                  <span>付款</span>
                </div>
                <el-popover
                ref="poverMerge"
                placement="bottom"
                width="100"
                trigger="hover"
                :visible-arrow="false">
                <div class="item-img" @click="handleExport" style="display:block;float:none">
                  <img class="SuppC-common-icon" src="../../../../static/content/images/Common/common-export.png" alt=""/>
                  <span>导出</span>
                </div>
                </el-popover>
                <div class="list-img" v-popover:poverMerge>
                  <img class="SuppC-common-icon" src="../../../../static/content/images/Common/common-more.png" alt=""/>
                </div>
              </el-form-item>
            </el-form>
          </el-col>
          <!--列表-->
          <el-table v-if="dataList" 
          :data="dataList" 
          ref="multipleTable"
          @row-dblclick="handleEdit"
          tooltip-effect="dark"
          @selection-change="handleSelectionList"
          highlight-current-row  
          v-loading="loading"
          element-loading-text="正在加载中"
          style="width: 100%">
            <el-table-column
              prop="A"
              label="单据日期"
              width="150"
              sortable>
            </el-table-column>
            <el-table-column
              prop="B"
              label="单据编号"
              width="150"
              sortable>
            </el-table-column>
            <el-table-column
              prop="C"
              label="单据名称"
              width="150"
              sortable>
            </el-table-column>
            <el-table-column
              prop="D"
              label="付款进度"
              width="150">
            </el-table-column>
            <el-table-column
              prop="E"
              label="发票金额"
              width="150">
            </el-table-column>
            <el-table-column
              prop="F"
              label="发票号码"
              width="150">
            </el-table-column>
            <el-table-column
              prop="G"
              label="供应商"
              show-overflow-tooltip>
            </el-table-column>
            <el-table-column
              prop="H"
              label="状态"
              width="150">
            </el-table-column>
            <el-table-column
              label="操作">
              <template slot-scope="scope">
                <div class="list-img" @click="repeal(scope.$index, scope.row)">
                  <img class="common-icon" src="../../../../static/content/images/Common/common-repeal.png" alt=""/>
                </div>
                <div class="list-img" @click="checkflowRow(scope.$index, scope.row)">
                  <img class="common-icon" src="../../../../static/content/images/Common/common-flow.png" alt=""/>
                </div>
                <div class="list-img" @click="handleDel(scope.$index, scope.row)">
                  <img class="common-icon" src="../../../../static/content/images/Common/common-list-dele.png" alt=""/>
                </div>
              </template>
            </el-table-column>
          </el-table>
          <!--查询-->
          <el-dialog title="查询" :visible.sync="dialogSearchVisible" :modal-append-to-body="false" size="tiny">
            <el-form :model="Searchform"  class="Searform">
              <el-form-item label="单据日期" :label-width="formLabelWidth">
                <el-date-picker type="date" v-model="Searchform.A" style="width:120px;" placeholder="选择日期"></el-date-picker>
                至&nbsp;<el-date-picker type="date" v-model="Searchform.B" style="width:120px;" placeholder="选择日期"></el-date-picker>
              </el-form-item>
              <el-form-item label="发票金额" :label-width="formLabelWidth">
                <el-input v-model.number.trim="Searchform.C" auto-complete="off" style="width:120px;"></el-input>
                至&nbsp;<el-input v-model.number.trim="Searchform.D" auto-complete="off" style="width:120px;"></el-input>
              </el-form-item>
              <el-form-item label="付款进度" :label-width="formLabelWidth">
                <el-input v-model.number.trim="Searchform.C" auto-complete="off" style="width:120px;"></el-input>
                至&nbsp;<el-input v-model.number.trim="Searchform.D" auto-complete="off" style="width:120px;"></el-input>
              </el-form-item>
              <el-form-item label="单据编号" :label-width="formLabelWidth">
                <el-input v-model="Searchform.F" style="width:262px;"></el-input>
              </el-form-item>
              <el-form-item label="供应商" :label-width="formLabelWidth">
                <el-select v-model="Searchform.H" style="width:262px;" placeholder="请选择">
                  <el-option value="" label="全部">全部</el-option>
                  <el-option
                    v-for="item in options"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="状态" :label-width="formLabelWidth">
                <el-select v-model="Searchform.H" style="width:262px;" placeholder="请选择">
                  <el-option value="" label="全部">全部</el-option>
                  <el-option
                    v-for="item in options"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer cover">
              <el-button size="small" @click="Reset">重 置</el-button>
              <el-button size="small" @click="Query">确 定</el-button>
            </div>
          </el-dialog>
      </div>
      <!--采购发票-->
      <div v-if="isshowInvoice">
        <!-- 导航条 -->
		    <div class="flex-top">
            <div>
                <i class="el-icon-arrow-left back" @click="ToBack"></i>
                <span style="font-size:20px;vertical-align:middle;margin:0 10px;">
                  采购发票
                </span>
            </div>
            <!-- 右侧 -->
            <div class="flex">
                <span class="wrapper cover">
                  <div style="margin:10px;overflow:hidden;">
                    <div class="list-img" @click="Save()">
                      <el-tooltip class="item" effect="dark" content="保存" placement="bottom">
                        <img class="common-button-group" src="../../../../static/content/images/Common/common-save.png" alt=""/>
                      </el-tooltip>
                    </div>
                    <div class="list-img" @click="Submit()">
                      <el-tooltip class="item" effect="dark" content="提交" placement="bottom">
                        <img class="common-button-group" src="../../../../static/content/images/Common/common-submit.png" alt=""/>
                      </el-tooltip>
                    </div>
                  </div>
                </span>
            </div>
        </div>
        <main class="main"  style="width:1230px">
            <div class="main-left">
                <div>
                  <h3>单号</h3>
                  <strong>{{DocNo}}</strong>
                </div>
                <div>
                  <h3>日期</h3>
                  <div class="flex">
                    <el-date-picker type="date" v-model="DocDate" placeholder="选择日期">
                    </el-date-picker>
                  </div>
                </div>
                <div class="SuppC-Money">
                  <h3>发票金额</h3>
                  <el-input type="Number" v-model='name1' placeholder="请录入发票金额"></el-input>
                  <i class="icon iconfont icon-rmb"></i>
                </div>
            </div>
            <div class="main-right">
                <div class="left-form">
                  <el-form label-width="90px" class="form-content">
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label="供应商">
                          <el-select v-model="name1" placeholder="请选择" style="width:200px;">
                            <el-option
                              v-for="item in Names"
                              :key="item.value"
                              :label="item.label"
                              :value="item.value">
                            </el-option>
                          </el-select>
                        </el-form-item>
                      </el-col>
                      <el-col :span="24">
                        <el-form-item label="发票号码">
                          <el-input v-model="name1"  style="width:200px;" placeholder="请录入发票号码"></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="24">
                        <el-form-item label="对应进货单">
                          <el-input v-model="name1"  
                          style="width:200px;"
                           placeholder="请选择对应的采购进货单" 
                           icon="search" 
                           @focus="handleStockDialog"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-form>
                </div>
                <div class="right-form">
                  <el-form label-width="100px">
                    <el-form-item label="业务描述">
                      <el-input
                        class="Suppc-txtarea"
                        type="textarea"
                        :rows="3"
                        placeholder="请输入内容"
                        v-model="name1">
                      </el-input>
                    </el-form-item>
                  </el-form>
                </div>
            </div>
        </main>
        <div class="border-solid"></div>
        <div class="budget cover">
              <h3>开票明细</h3>  
              <table class="InHideTable" border="1">
                <tr>
                  <th style="width:150px;">单据编号</th>
                  <th style="width:150px;">单据名称</th>
                  <th style="width:180px;">存货编号</th>
                  <th style="width:180px;">存货名称</th>
                  <th style="width:100px;">入仓数量</th>
                  <th style="width:100px;">未开票数量</th>
                  <th style="width:100px;" class="font-green">本次开票数量</th>
                  <th style="width:100px;">单价</th>
                  <th style="width:100px;">金额</th>
                  <th style="width:100px;">税率</th>
                  <th style="width:100px;">税金</th>
                  <th style="width:100px;" class="font-green">价税总额</th>
                </tr>
                <tr v-for="(item,index) in InvoiceDetail" :key="index">
                  <td>{{item.A}}</td>
                  <td>{{item.B}}</td>
                  <td>{{item.C}}</td>
                  <td>{{item.D}}</td>
                  <td>{{item.E}}</td>
                  <td>{{item.F}}</td>
                  <td>
                    <el-input type="text" :ref="index * 3 + 1" @keyup.enter.native="jump(index * 3 + 1)" placeholder="请录入"  class="input-Focus white" v-model="item.G" ></el-input>
                  </td>
                  <td>{{item.H}}</td>
                  <td>{{item.I}}</td>
                  <td>{{item.J}}</td>
                  <td>
                    <el-input type="text" :ref="index * 3 + 2" @keyup.enter.native="jump(index * 3 + 2)" placeholder="请录入"  class="input-Focus white" v-model="item.K"></el-input>
                  </td>
                  <td>
                    <el-input type="text" :ref="index * 3 + 3" @keyup.enter.native="jump(index * 3 + 3)" placeholder="请录入"  class="input-Focus white"  v-model="item.L"></el-input>
                  </td>
                </tr>
                <tr>
                  <td colspan="8">合计</td>
                  <td>{{PrintCount}}</td>
                  <td></td>
                  <!-- <td>{{TaxRateCount}}</td> -->
                  <td>{{TaxCount}}</td>
                  <td>{{TaxAmountCount}}</td>
                </tr>
              </table>
              <h3>请核销预付款</h3>
              <table class="InHideTable"  border="1" style="width:1210px;margin: 0 0 0 20px;">
                <tr>
                  <!-- <th style="width:40px;">
                    <el-checkbox v-model="checked"  @change="fpCheck($event)"></el-checkbox>
                  </th> -->
                  <th style="width:150px;">单据编号</th>
                  <th style="width:150px;">单据名称</th>
                  <th style="width:150px;">单据日期</th>
                  <th style="width:120px;">预付总额</th>
                  <th style="width:120px;">已核销</th>
                  <th style="width:120px;">剩余未核销</th>
                  <th style="width:120px;">本次核销</th>
                </tr>
                <tr v-for="(item,index) in WriteOff" :key="index">
                  <!-- <td><el-checkbox  class="testCheckBox"></el-checkbox></td> -->
                  <td>{{item.A}}</td>
                  <td>{{item.B}}</td>
                  <td>{{item.C}}</td>
                  <td>{{item.D}}</td>
                  <td>{{item.E}}</td>
                  <td>
                    {{item.F}}
                  </td>
                  <td>
                    <el-input type="text" :ref="index * 1 + 1" @keyup.enter.native="jump(index * 1 + 1)" placeholder="请录入" class="input-Focus white" v-model="item.G"></el-input>
                  </td>
                </tr>
                <tr>
                  <td colspan="6">合计</td>
                  <td>{{verification}}</td>
                </tr>
              </table>
          </div>
        </div>
        <div></div>
        <!--流程图-->
        <el-dialog title="流程执行情况" :visible.sync="checkflowRowVisible" :modal-append-to-body="false" align="center">
          <el-table :data="docRowView" min-height="300" header-align="center" v-loading="docViewloading" element-loading-text="拼命刷新中...">
            <el-table-column property="PlanUser" label="操作人"></el-table-column>
            <el-table-column property="StepName" label="步骤名称"></el-table-column>
            <el-table-column property="OpDate" label="时间"></el-table-column>
            <el-table-column property="OpRemark" label="审批流程"></el-table-column>
          </el-table>
        </el-dialog>
      </div>
      <!--采购付款单-->
      <div v-if="isshowPay">
        <!-- 导航条 -->
		    <div class="flex-top">
          <div>
            <i class="el-icon-arrow-left back" @click="ToBack"></i>
            <span style="font-size:20px;vertical-align:middle;margin:0 10px;">
              采购付款单
            </span>
          </div>
          <!-- 右侧 -->
          <div class="flex">
            <span class="wrapper cover">
              <div style="margin:10px;overflow:hidden;">
                <div class="list-img" @click="Save()">
                  <el-tooltip class="item" effect="dark" content="保存" placement="bottom">
                    <img class="common-button-group" src="../../../../static/content/images/Common/common-save.png" alt=""/>
                  </el-tooltip>
                </div>
                <div class="list-img" @click="Submit()">
                  <el-tooltip class="item" effect="dark" content="提交" placement="bottom">
                    <img class="common-button-group" src="../../../../static/content/images/Common/common-submit.png" alt=""/>
                  </el-tooltip>
                </div>
              </div>
            </span>
          </div>
        </div>
        <main class="main" style="width:1120px">
          <div class="main-left">
            <div v-if="DocNo">
              <h3>单号</h3>
              <strong>{{DocNo}}</strong>
            </div>
            <div>
              <h3>日期</h3>
              <div class="flex">
                <el-date-picker type="date" v-model="DocDate" placeholder="选择日期">
                </el-date-picker>
              </div>
            </div>
            <div class="SuppC-Money">
              <h3>付款金额</h3>
              <el-input type="Number" v-model='name1' placeholder="请录入付款金额"></el-input>
              <i class="icon iconfont icon-rmb"></i>
            </div>
          </div>
          <div class="main-right">
            <div class="left-form">
              <el-form label-width="70px" class="form-content">
                <el-row>
                  <el-col :span="24">
                    <el-form-item label="供应商">
                      <el-select 
                        ref="select"
                        v-model="name1" 
                        filterable  
                        placeholder="请选择供应商" 
                        style="width:200px;">
                        <el-option
                          v-for="item in Names"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value">
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="24">
                    <el-form-item label="业务描述">
                      <el-input
                        type="textarea"
                        style="width:555px;"
                        :rows="5"
                        placeholder="请输入内容"
                        v-model="name1">
                      </el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-form>
            </div>
          </div>
        </main>
        <div class="border-solid"></div>
        <div class="budget cover" style="width:1120px;">
          <h3>请录入付款明细</h3>
          <div class="SuppC-Nas-itemRight">
            <el-popover
              ref="popover1"
              placement="top-start"
              width="200"
              trigger="click">
              <h3 class="Suppc-help-titleRed">没有找到对应的付款明细？</h3>
              <ul class="Suppc-help-ul">
                <el-popover
                  ref="popover1"
                  v-model="pop1"
                  placement="right"
                  width="200"
                  trigger="click">
                  <h3 class="Suppc-help-titleGay">物品没入仓</h3>
                  <hr style="margin-top:15px;">
                  <ul class="Suppc-help-ul">
                    <li @click="NewsIn()">申请入仓</li>
                    <li @click="NewsAdvance()">申请预付</li>
                  </ul>
                </el-popover>
                <li v-popover:popover1 @click="popClick(1)">物品没入仓</li>
                <el-popover
                  ref="popover2"
                  v-model="pop2"
                  placement="right"
                  width="200"
                  trigger="click">
                  <h3 class="Suppc-help-titleGay">结算方式为发票结算,但未收到发票</h3>
                  <hr style="margin-top:15px;">
                  <ul class="Suppc-help-ul">
                    <li @click="NewsInvoice()">新建发票</li>
                    <li @click="NewsAdvance()">申请预付</li>
                  </ul>
                </el-popover>
                <li v-popover:popover2 @click="popClick(2)">结算方式为发票结算，但未收到发票</li>
                <li @click="SupplierError()">供应商选错</li>
              </ul>
            </el-popover>
            <i class="icon iconfont icon-iconfontquestion" v-popover:popover1></i>
            <span style="font-size:14px;line-height:1.5;">帮助</span>
          </div>
          <table class="InHideTable" border="1" style="width:1080px;">
            <tr>
              <th style="width:150px;">单据编号</th>
              <th style="width:150px;">单据名称</th>
              <th style="width:120px;">单据日期</th>
              <th style="width:120px;">应付总额</th>
              <th style="width:120px;">已付总额</th>
              <th style="width:120px;">剩余未付</th>
              <th style="width:120px;" class="font-green">本次付款</th>
            </tr>
            <tr v-for="(item,index) in PayDetail" :key="index">
              <td>{{item.A}}</td>
              <td>{{item.B}}</td>
              <td>{{item.C}}</td>
              <td>{{item.D}}</td>
              <td>{{item.E}}</td>
              <td>{{item.F}}</td>
              <td>
                <el-input :ref="index * 1 + 1" @keyup.enter.native="jump(index * 1 + 1)" placeholder="请录入" type="text" class="input-Focus white" v-model="item.G"></el-input>
              </td>
            </tr>
            <tr>
              <td colspan="3">合计</td>
              <td>{{copeWithCount}}</td><!--应付总额-->
              <td>{{paidCount}}</td><!--已付总额-->
              <td>{{surplusCount}}</td><!--剩余未付-->
              <td>{{thisCount}}</td><!--本次付款-->
            </tr>
          </table>
        </div>
      </div>
      <!-- 导出询问框 -->
      <el-dialog title="请选择导出的内容" :visible.sync="ExportDialog" :modal-append-to-body="false" size="tiny">
        <el-radio-group v-model="radioExport">
          <el-radio :label="1">导出模板</el-radio>
          <el-radio :label="2">导出订单明细</el-radio>
        </el-radio-group>
        <div slot="footer" class="dialog-footer cover">
          <el-button size="small" @click="Cancel">取 消</el-button>
          <el-button size="small" @click="Determine">确 定</el-button>
        </div>
      </el-dialog>
      <!--采购进货单窗口-->
      <el-dialog 
      title="进货单"
      :visible.sync="StockDialog" 
      :modal-append-to-body="false">
          <el-input
            placeholder="请输入关键字查询"
            style="width:200px;margin-bottom:10px;"
            icon="search"
            v-model="name1"
            :on-icon-click="stockSearch">
          </el-input>
          <el-table
            :data="StockList"
            style="width:100%"
            highlight-current-row
            @selection-change="handleSelectionList">
            <el-table-column type="selection" width="55"></el-table-column>
            <el-table-column
              prop="A"
              label="进货单号">
            </el-table-column>
            <el-table-column
              prop="B"
              label="采购金额">
            </el-table-column>
            <el-table-column
              prop="C"
              label="未开票金额">
            </el-table-column>
            <el-table-column
              prop="D"
              label="采购订单号">
            </el-table-column>
          </el-table>
          <div slot="footer" class="dialog-footer cover">
            <el-button size="small" @click="StockDialog = false">取 消</el-button>
            <el-button size="small" @click="confirm">确定</el-button>
          </div>
      </el-dialog>
  </section>
</template>
<script>
    export default {
      name:"PurchaseInvoice",
      data(){
        return {
          isshowList:true,//列表
          isshowPay:false,//付款单
          isshowInvoice:false,//采购发票
          dialogSearchVisible:false,//查询窗口
          StockDialog:false,
          formLabelWidth:'70px',
          name1:'',
          loading: true, //显示列表loading
          checkflowRowVisible:false,
          docViewloading:false,
          radioExport:1,
          options:[{
            value: '1',
            label: '黄金糕'
          },{
            value: '2',
            label: '双皮奶'
          }],
          InvoiceDetail:[{
            A:"CH18020014",
            B:"采购进货",
            C:"10018",
            D:"500ML统一阿萨姆奶茶",
            E:1000,
            F:1000,
            G:1500,
            H:2.97,
            I:6,
            J:3.14467,
            K:4455.00,
            L:'',
          },{
            A:"CH18020014",
            B:"采购进货",
            C:"10018",
            D:"500ML统一阿萨姆奶茶",
            E:1000,
            F:1000,
            G:1500,
            H:2.97,
            I:6,
            J:3.14467,
            K:4455.00,
            L:'',
          },{
            A:"CH18020014",
            B:"采购进货",
            C:"10018",
            D:"500ML统一阿萨姆奶茶",
            E:1000,
            F:1000,
            G:1500,
            H:2.97,
            I:6,
            J:3.14467,
            K:4455.00,
            L:'',
          },{
            A:"CH18020014",
            B:"采购进货",
            C:"10018",
            D:"500ML统一阿萨姆奶茶",
            E:1000,
            F:1000,
            G:1500,
            H:2.97,
            I:6,
            J:3.14467,
            K:4455.00,
            L:'',
          }],
          StockList:[
            {
                A:'CH18030010',
                B:1500,
                C:1500,
                D:'SC18030005'
            },
            {
                A:'CH18030011',
                B:5500,
                C:3000,
                D:'SC18030005'
            },
            {
                A:'CH18030012',
                B:4000,
                C:6600,
                D:'SC18030777'
            }
          ],
          dataList:[{
              A: '2016-05-03',
              B: 'CP18010001',
              C: '采购发票',
              D: '50%',
              E: 15000,
              F: 'BG18010005',
              G: '广州市品冠电子有限公司',
              H: '待审核',
              I: '待审核'
          },{
              A: '2016-05-03',
              B: 'CP18010001',
              C: '采购发票',
              D: '50%',
              E: 15000,
              F: 'BG18010005',
              G: '广州市品冠电子有限公司',
              H: '待审核',
              I: '待审核'
          },{
              A: '2016-05-03',
              B: 'CP18010001',
              C: '采购发票',
              D: '50%',
              E: 15000,
              F: 'BG18010005',
              G: '广州市品冠电子有限公司',
              H: '待审核',
              I: '待审核'
          },{
              A: '2016-05-03',
              B: 'CP18010001',
              C: '采购发票',
              D: '50%',
              E: 15000,
              F: 'BG18010005',
              G: '广州市品冠电子有限公司',
              H: '待审核',
              I: '待审核'
          }],
          loading:false,
          inputIndex:0,
          isshowSettle:true,
          DocDate:'',
          DocNo:'CKD188097772',
          ExportDialog:false,//询问窗口
          PayDetail:[{
            A:'CH18010005',
            B:'采货进货单',
            C:'2018-1-10',
            D:500,
            E:'',
            F:500,
            G:''
          },{
            A:'YF18010006',
            B:'预付款',
            C:'2018-1-10',
            D:350,
            E:100,
            F:500,
            G:''
          }],
          pop1:false,
          pop2:false,
          //核销预付款
          WriteOff: [
            {
              A: "YF180100010",
              B: "预付款",
              C: "2018-01-31",
              D: 5363,
              E: 0,
              F: 5363,
              G: 5363.0
            }
          ],
          docRowView:[{
            PlanUser:"杨晓莉",
            StepName:"提交",
            OpDate:"2018/1/25 16:25:55",
            OpRemark:""
          },{
            PlanUser:"杨晓莉",
            StepName:"提交",
            OpDate:"2018/1/25 16:25:55",
            OpRemark:""
          },{
            PlanUser:"杨晓莉",
            StepName:"提交",
            OpDate:"2018/1/25 16:25:55",
            OpRemark:""
          },{
            PlanUser:"杨晓莉",
            StepName:"提交",
            OpDate:"2018/1/25 16:25:55",
            OpRemark:""
          }],
          Searchform:{
            A:'',
            B:'',
            C:'',
            D:'',
            E:'',
            F:'',
            G:'',
            H:''
          },
          Names:[{
            label:'1',
            value:"1"
          },{
            label:'1',
            value:"2"
          }],
          checked:false,
        }
      },
      methods:{
        search(){
          this.dialogSearchVisible = true;
        },
        async Query(){
          this.dialogSearchVisible = false;
        },
        //申请入仓
        NewsIn(){
          this.$router.push({
            path:'/PurchaseIn',
            query:{
              InYes:true,
              generate:true
            }
          })
        },
        //新建发票
        NewsInvoice(){
          this.$router.push({
            path:'/PurchaseInvoice',
            query:{
              News:true
            }
          })
          this.isshowInvoice = true;
          this.isshowList = false;
          this.isshowPay = false
        },
        //流程图
        checkflowRow(){
          this.checkflowRowVisible = true;
        },
        SupplierError(){
          console.log(this.$refs['select'],"this.$refs['select']");
          this.$refs['select'].visible = true;
        },
        handleDel(index,row){
          this.$confirm("确认删除该记录吗?", "提示", {
            type: "warning"
          }).then(() => {
            this.$message({
              type: "success",
              message: "删除成功",
            });
          })
        },
        confirm(){
          this.StockDialog = false;
        },
        /* fpCheck(event){
          let checkTests = document.getElementsByClassName('testCheckBox')
          console.log(checkTests)
          console.log(event.currentTarget.checked);
          for(let i = 0 ; i < checkTests.length ; i++){
            console.log(checkTests);
            if(event.currentTarget.checked){
                checkTests[i].children[0].className += " is-checked";
            }else{
              checkTests[i].children[0].className = checkTests[i].children[0].className.split('is-checked')[0]
            }
          }
        }, */
        //点击导出时弹出询问框
        handleExport(){
          this.ExportDialog = true;
        },
        stockSearch(){

        },
        //申请预付
        NewsAdvance(){
          this.$router.push({
            path:'/PurchasePayment',
            query:{
              isAdPay:true
            }
          })
        },
        //帮助=》Pop浮窗切换显示隐藏
        popClick(e){
          if(e===1){
            this.pop1=true
            this.pop2=false
          }else{
            this.pop1=false
            this.pop2=true
          }
        },
        // 撤销
        repeal(index, row) {
          this.$confirm("确认撤销吗?", "提示", {
            type: "warning"
          }).then(() => {
            this.$message({
              type: "success",
              message: "撤销成功"
            });
          });
        },
        jump(index) {
          if (this.$refs[index + 1]) {
            this.$refs[index + 1][0].$el.getElementsByTagName('input')[0].focus();
          }
        },
        Determine(){
          this.ExportDialog = false;
          console.log(this.radioExport,'this.radioExport');
        },
        //弹框取消按钮
        Cancel(){
          this.ExportDialog = false;
        },
        //重置
        Reset(){
          this.Searchform = {
            A:'',
            B:'',
            C:'',
            D:'',
            E:'',
            F:'',
            G:'',
            H:''
          }
        },
        Save(){},
        Submit(){},
        //多选
        handleSelectionList(val) {
          let arr = [];
          this.multipleSelection = val;
          this.multipleSelection.forEach((item,index)=>{
            console.log(item.date,'item');
            arr.push(item.date)
          })
          const arrjoin = arr.join();
          console.log(arrjoin);
        },
        // 新建返回到列表页面
        ToBack() {
          this.isshowList = true;
          this.isshowInvoice = false;
          this.isshowPay = false;
          this.$router.push({
            path:'/PurchaseInvoice'
          })
        },
        handleStockDialog(){
          //打开进货单列表窗口
          this.StockDialog = true;
        },
        handlePay(){
          this.isshowPay = true;
          this.isshowList = false;
        },
        handleInvoice(index,row){
          this.isshowInvoice = true;
          this.isshowPay = false;
          this.isshowList = false;
          if(this.isUndefined(row)){
            console.log('新建');
            this.$router.push({
              path:'/PurchaseInvoice',
              query:{
                News:true,
              }
            })
          }else{
            console.log('修改');
            this.$router.push({
              path:'/PurchaseInvoice',
              query:{
                Edit:true,
              }
            })
          }
        },
        handleEdit(row){
          this.isshowInvoice = true;
          this.isshowList = false;
        }
      },
      computed: {
        //采购付款单 应付总额
        copeWithCount(){
          let sum = 0;
          this.PayDetail.forEach(item=>{
            sum+=Number(item.D);
          })
          return sum;
        },
        //采购付款单 已付总额
        paidCount(){
          let sum = 0;
          this.PayDetail.forEach(item=>{
            sum+=Number(item.E);
          })
          return sum;
        },
        //采购付款单 剩余未付
        surplusCount(){
          let sum = 0;
          this.PayDetail.forEach(item=>{
            sum+=Number(item.F);
          })
          return sum;
        },
        //采购付款单 本次付款
        thisCount(){
          let sum = 0;
          this.PayDetail.forEach(item=>{
            sum+=Number(item.G);
          })
          return sum;
        },
        //本次核销
        verification(){
          let sum = 0;
          this.WriteOff.forEach(item=>{
            sum+=Number(item.G);
          })
          return sum;
        },
        //发票 税率=》合计
        TaxRateCount(){
          let sum = 0;
          this.InvoiceDetail.forEach(item=>{
            sum+=Number(item.J);
          })
          return sum;
        },
        //发票 金额=》合计
        PrintCount(){
          let sum = 0;
          this.InvoiceDetail.forEach(item=>{
            sum+=Number(item.I);
          })
          return sum;
        },
        //发票 税金=》合计
        TaxCount(){
          let sum = 0;
          this.InvoiceDetail.forEach(item=>{
            sum+=Number(item.K);
          })
          return sum;
        },
        //发票 价税总额=》合计
        TaxAmountCount(){
          let sum = 0;
          this.InvoiceDetail.forEach(item=>{
            sum+=Number(item.L);
          })
          return sum;
        }
      },
      mounted(){
        
      },
      created () {
        const query = this.$route.query;
        console.log(query,'query');
        if(query.generate && query.generate==true){
          this.isshowInvoice = true;
          this.isshowList = false;
        }else if(query.News && (query.News===true || query.News === 'true' )){
          this.isshowInvoice = true;
          this.isshowList = false;
        }
      }
    }
</script>
<style scoped lang="scss">
@import "../../../common/css/index.css";
.toolbar h2 {
  line-height: 36px;
  margin: 0 10px 0 0;
}
.toolbar .title {
  display: inline-flex;
  line-height: 5px;
  width: 100%;
  justify-content: space-between;
}
.main-left{
  padding:1vw 1vw;
}
.main-left h3{
  height: 20px;
  line-height: 20px;
  margin-bottom: 10px;
}
.left-form,.right-form{
  display: flex;
  justify-content: center;
  align-items: center;
}
.el-table .cell{
  padding:0 0;
}
.common-icon{
  line-height:24px;
  float:none
}


</style>